<%@ page contentType="text/html;charset=UTF-8" language="java"
	isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>文件管理器</title>
<!-- 新 Bootstrap4 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
	<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
	<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
	<!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
	<script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script>
	<!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
	<script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style type="text/css">
		body {
			background-image: url('./image/background.jpg');
		}
		.middle {
			margin-top: 110px;
			margin-bottom: 110px;
			padding: 100px 50px 50px 50px;
			background-color: white;
			border-radius: 15px;
			box-shadow: 10px 10px 5px rgb(0,0,0,0.1);
			
		}
		.login {
			margin-left: 20px;
		}
		.font2 {
			font-size: 0.6em;
		}
		.btn {
			border-radius: 28px;
		}

	</style>

	<script type="text/javascript">

	</script>
<script>
	function check() {
		var username = document.getElementById("username").value;
		var file = document.getElementById("file").value;
		if (username == "") {
			alert("填写上传人");
			return false;
		}
		if (file.length == 0 || file == "") {
			alert("请选择上传文件");
			return false;
		}

		return true;
	}
</script>
</head>
<body>


<div class="container">
		<div class="middle mx-auto h-75 w-75">
			<div class="row">
				<div class="col col-12 col-md-6">
					<img class="rounded img-fluid" >
				</div>
				<div class="col col-12 col-md-6">
					<div class="login">
						<h5 class="font-weight-bold">文件管理器</h5>
						<p class="font-weight-light font2">文件上传</p>

						<form action="${pageContext.request.contextPath }${uploadFile==null?'/addFile':'/updateFile'}"
						method="post" enctype="multipart/form-data" onsubmit="return check()">
							
							<div class="form-group">
								<label for="email" class="sr-only">用户名:</label>

								<input type="text" class="form-control" id="username" name="username"
								value="${uploadFile.username}" placeholder="用户名">
							</div>

							<div class="form-group">
								<label for="pwd" class="sr-only">文件:</label>
								<input type="file" class="form-control" id="file"  name="uploadfile" 
								multiple="multiple" placeholder="文件" value="${uploadFile.filename}" >
							</div>

							

							<br>
							<button type="submit" class="btn btn-primary btn-block w-75 mx-auto">上传</button>
						</form>

					</div>
				</div>
			</div>
		</div>
	</div>
	
</body>
</html>
